import Vue from "vue";
import Router from "vue-router";
import Layout from "../views/Layout/";
import Home from "./routers/home";
import Dashboard from "./routers/dashboard";
import Demonstration from "./routers/Demonstration";

const Login = () =>
  import(/* webpackChunkName: "group-login" */ "../views/Login/Login.vue");
const Page404 = () =>
  import(/* webpackChunkName: "group-global" */ "../views/404/404.vue");

Vue.use(Router);
export default new Router({
  // mode: 'history',
  // base: process.env.BASE_URL,
  routes: [
    {
      path: "/",
      // redirect: '/dashboard',
      component: Layout,
      hidden: false,
      meta: {
        title: "统计台",
        icon: "fa fa-dashboard",
        roles: ["admin", "user1", "user1", "user3", "user4", "user5", "user6"]
      },
      children: Dashboard
    },
    {
      path: "/home",
      // redirect: '/home',
      component: Layout,
      hidden: false,
      meta: {
        title: "首页",
        icon: "fa fa-home",
        roles: ["admin", "user1", "user1", "user3", "user4", "user5", "user6"]
      },
      children: Home
    },
    {
      path: "/demo/tableDemo",
      // redirect: '/home',
      component: Layout,
      hidden: false,
      meta: {
        title: "通用组件展示",
        icon: "fa fa-puzzle-piece",
        roles: ["admin", "user1", "user1", "user3", "user4", "user5", "user6"]
      },
      children: Demonstration
    },
    {
      path: "/login",
      component: Login,
      hidden: false,
      meta: {
        title: "后台管理框架登录页"
      }
    },
    {
      path: "/404",
      component: Page404,
      hidden: false,
      meta: {
        title: "404"
      }
    },
    {
      path: "*",
      redirect: "/404",
      hidden: false
    }
  ]
});
